#define __display_c

#include    "includeAll.h"

code const uint8_t displayFonts[10] =
{
    0x3f,  /*0*/
    0x06,  /*1*/
    0x5b,  /*2*/
    0x4f,  /*3*/
    0x66,  /*4*/
    0x6d,  /*5*/
    0x7d,  /*6*/
    0x07,  /*7*/
    0x7f,  /*8*/
    0x6f,  /*9*/
};

void DisplayScan(void)
{

    clr_led_curTemp1;
    clr_led_curTemp2;
    clr_led_curTemp3;
    clr_led_curTemp4	;
	
    curTempFlagOn;
    curTempH=curTemp/10;
    curTempL=curTemp%10;
    d_seg=displayFonts[curTempH];
    if(f_seg_a)    {set_led_1a;  set_led_2a;}
    if(f_seg_b)    {set_led_1b;  set_led_2b;}
    if(f_seg_c)    {set_led_1c;  set_led_2c;}
    if(f_seg_d)    {set_led_1d;  set_led_2d;}
    if(f_seg_e)    {set_led_1e;  set_led_2e;}
    if(f_seg_f)    {set_led_1f;  set_led_2f;}
    if(f_seg_g)    {set_led_1g;  set_led_2g;}

    d_seg=displayFonts[curTempL];
    if(f_seg_a)    {set_led_3a;  set_led_4a;}
    if(f_seg_b)    {set_led_3b;  set_led_4b;}
    if(f_seg_c)    {set_led_3c;  set_led_4c;}
    if(f_seg_d)    {set_led_3d;  set_led_4d;}
    if(f_seg_e)    {set_led_3e;  set_led_4e;}
    if(f_seg_f)    {set_led_3f;  set_led_4f;}
    if(f_seg_g)    {set_led_3g;  set_led_4g;}
    if(bPowerOnOff)
    {
        clr_led_setTempBuff1;
        clr_led_setTempBuff2	;
        setTempH=setCurTemp/10;
        setTempL=setCurTemp%10;
        setTempChar1On;
        setTempChar2On;
        setTempFlagOn;
        d_seg=displayFonts[setTempH];
        if(f_seg_a)    set_led_5a;
        if(f_seg_b)    set_led_5b;
        if(f_seg_c)    set_led_5c;
        if(f_seg_d)    set_led_5d;
        if(f_seg_e)    set_led_5e;
        if(f_seg_f)    set_led_5f;
        if(f_seg_g)    set_led_5g;

        d_seg=displayFonts[setTempL];
        if(f_seg_a)    set_led_6a;
        if(f_seg_b)    set_led_6b;
        if(f_seg_c)    set_led_6c;
        if(f_seg_d)    set_led_6d;
        if(f_seg_e)    set_led_6e;
        if(f_seg_f)    set_led_6f;
        if(f_seg_g)    set_led_6g;

        clr_led_gearBuff;
        gearFull=gear;
        gearCharOn;
        d_seg=displayFonts[gearFull];
        if(f_seg_a)    set_led_7a;
        if(f_seg_b)    set_led_7b;
        if(f_seg_c)    set_led_7c;
        if(f_seg_d)    set_led_7d;
        if(f_seg_e)    set_led_7e;
        if(f_seg_f)    set_led_7f;
        if(f_seg_g)    set_led_7g;

        
        if(function==1)
        {
            lowWorkCharOn;
            highWorkCharOff;
            killWorkCharOff;

        }
		
		
        else if(function==2)
        {
            lowWorkCharOff;
            highWorkCharOn;
            killWorkCharOff;

        }
        else if(function==3)
        {
            lowWorkCharOff;
            highWorkCharOff;
            killWorkCharOn;

        }
        else if	(function==4)
        {
         
            
                lowWorkCharOff;
                highWorkCharOff;
                killWorkCharOff;

            
        }
		
		if(bOrderOpen==0)
		{
			
		
        if(bSaveTemp==0)
        {
            heatCharOn;
            saveTempCharOff;
			if(curTemp<=50)
			{
				 if(bSecFlash500ms)
				{
					blueLedOn;
					redLedOff;
				}
			else
				{
					blueLedOff;
					redLedOff;
				}
			}
			else if((curTemp<=60)&&(curTemp>50))
			{
				if(bSecFlash500ms)
				{
					blueLedOn;
					redLedOn;
				}
				else 
				{
					blueLedOff;
					redLedOff;
				}
			}
			else if((curTemp>60)&&(curTemp<=90))
			{
				if(bSecFlash500ms)
				{
					blueLedOff;
					redLedOn;
				}
				else
				{
					blueLedOff;
					redLedOff;
				}
			}
           
        }
        else
        {
            heatCharOff;
            saveTempCharOn;
            if(curTemp<=50)
			{
				
					blueLedOn;
					redLedOff;
			
			}
			else if((curTemp<=60)&&(curTemp>50))
			{
				
					blueLedOn;
					redLedOn;
				
			}
			else if((curTemp>60)&&(curTemp<=90))
			{
				
					blueLedOff;
					redLedOn;
				
			}
        } 
		}  

	  switch(setFunctionNum)
	  {
		  case 0:
		  ZaoShangCharOff;
		  XiaWuCharOff;
		  WanShangCharOff;
		  break;
		  case 6:
		  case 7:
		  case 8:
		  case 9:
		  ZaoShangCharOn;
		  XiaWuCharOff;
		  WanShangCharOff;
		  break;
		    case 10:
		  case 11:
		  case 12:
		  case 13:
		 ZaoShangCharOff;
		  XiaWuCharOn;
		  WanShangCharOff;
		  break;
		 case 14:
		  case 15:
		  case 16:
		  case 17:
		  ZaoShangCharOff;
		  XiaWuCharOff;
		  WanShangCharOn;
		  break;
	  }
    }

    clr_led_clockBuff1;
    clr_led_clockBuff2;
    clr_led_clockBuff3;
    clr_led_clockBuff4;
	  
		switch(setFunctionNum)
    {
    case 0:
    case 4:
    case 5:

        clockHourH=mainClockHour/10;
        clockHourL=mainClockHour%10;
        clockMinH =mainClockMin/10;
        clockMinL =mainClockMin%10;
	
        orderCloseOff;
        orderOpenOff;
        clockCharOn;
        break;


    case 6:
    case 7: 
	clockHourH =MorderClockOpenHour/10;
        clockHourL = MorderClockOpenHour%10;
        clockMinH =  MorderClockOpenMin/10;
        clockMinL =  MorderClockOpenMin%10;
        orderCloseOff;
        orderOpenOn;
        clockCharOff;
        break;
	case 10:
    case 11:
	clockHourH =AorderClockOpenHour/10;
        clockHourL = AorderClockOpenHour%10;
        clockMinH =  AorderClockOpenMin/10;
        clockMinL =  AorderClockOpenMin%10;
        orderCloseOff;
        orderOpenOn;
        clockCharOff;
        break;
	case 14:
    case 15:
clockHourH =NorderClockOpenHour/10;
        clockHourL =NorderClockOpenHour%10;
        clockMinH =  NorderClockOpenMin/10;
        clockMinL =  NorderClockOpenMin%10;
        orderCloseOff;
        orderOpenOn;
        clockCharOff;
       

break;
    case 8:
    case 9:
	  clockHourH	=MorderClockCloseHour/10;
        clockHourL	=MorderClockCloseHour%10;
        clockMinH 	=MorderClockCloseMin/10;
        clockMinL =	MorderClockCloseMin%10;
        orderCloseOn;
        orderOpenOff;
        clockCharOff;
        break;
	case 12:
    case 13:
	  clockHourH	=AorderClockCloseHour/10;
        clockHourL	=AorderClockCloseHour%10;
        clockMinH 	=AorderClockCloseMin/10;
        clockMinL =	AorderClockCloseMin%10;
        orderCloseOn;
        orderOpenOff;
        clockCharOff;
        break;
	case 16:
    case 17:
        clockHourH	=NorderClockCloseHour/10;
        clockHourL	=NorderClockCloseHour%10;
        clockMinH 	=NorderClockCloseMin/10;
        clockMinL =	NorderClockCloseMin%10;
        orderCloseOn;
        orderOpenOff;
        clockCharOff;
        break;
    }
    d_seg=displayFonts[clockHourH];
    if(f_seg_a)    set_led_8a;
    if(f_seg_b)    set_led_8b;
    if(f_seg_c)    set_led_8c;
    if(f_seg_d)    set_led_8d;
    if(f_seg_e)    set_led_8e;
    if(f_seg_f)    set_led_8f;
    if(f_seg_g)    set_led_8g;

    d_seg=displayFonts[clockHourL];
    if(f_seg_a)    set_led_9a;
    if(f_seg_b)    set_led_9b;
    if(f_seg_c)    set_led_9c;
    if(f_seg_d)    set_led_9d;
    if(f_seg_e)    set_led_9e;
    if(f_seg_f)     set_led_9f;
    if(f_seg_g)    set_led_9g;


    d_seg=displayFonts[clockMinH];
    if(f_seg_a)    set_led_10a;
    if(f_seg_b)    set_led_10b;
    if(f_seg_c)    set_led_10c;
    if(f_seg_d)    set_led_10d;
    if(f_seg_e)    set_led_10e;
    if(f_seg_f)     set_led_10f;
    if(f_seg_g)    set_led_10g;

    d_seg=displayFonts[clockMinL];
    if(f_seg_a)    set_led_11a;
    if(f_seg_b)    set_led_11b;
    if(f_seg_c)    set_led_11c;
    if(f_seg_d)    set_led_11d;
    if(f_seg_e)    set_led_11e;
    if(f_seg_f)     set_led_11f;
    if(f_seg_g)    set_led_11g;

	
	if((bPowerOnOff==1)&&(flashSetFunction<=0))
	{
		if(bOrderOpen)
		{
			orderOpenOn;
			orderCloseOff;
			saveTempCharOn;
			heatCharOff;
			blueLedOn;
		}
	
		if(bOrderClose)
		{
			orderOpenOff;
			orderCloseOn;
		}
			if((bOrderClose)||(bOrderOpen))
	{
		if((mainClockHour<=7)&&(mainClockHour>=0))
		{
			ZaoShangCharOn;
		}
		if((mainClockHour<=15)&&(mainClockHour>7))
		{
			XiaWuCharOn;
		}
		if((mainClockHour<=23)&&(mainClockHour>15))
		{
			WanShangCharOn;
		}
	}
	else
	{
		ZaoShangCharOff;
		XiaWuCharOff;
		WanShangCharOff;
	}
	
	}
}